package com.lbn.jfqsc.app.message.performance;

import com.lbn.baseframe.mvp.BasePresenter;
import com.lbn.baseframe.net.business.RxSubscribe;
import com.lbn.jfqsc.business.bean.ActivityList;
import com.lbn.jfqsc.net.Host;

import java.util.List;

/**
 * @author 李炳南
 * @date 2017/3/3
 */
public class PfmPresenter extends BasePresenter<IPfmView> {


    public void activityList(final int page, int type) {

        subscribeNetwork(Host.getApi().activityList(page, type), new RxSubscribe<List<ActivityList>>() {
            @Override
            public void next(List<ActivityList> o) {
                if (page == 1) {
                    getView().setData(o);
                } else {
                    getView().addData(o);
                }

                if (o.size() < 10) {
                    getView().isMore(false);
                } else {
                    getView().isMore(true);
                }

            }

            @Override
            public void error(Throwable e) {
                getView().onError(e.getMessage());
            }
        });


    }


}
